class Student:
    def __init__(self, id, name, age, grade):
        self.id = id
        self.name = name
        self.age = age
        self.grade = grade

    def __str__(self):
        return f"ID: {self.id}, Name: {self.name}, Age: {self.age}, Grade: {self.grade}"

class StudentManager:
    def __init__(self):
        self.students = {}

    def add_student(self, id, name, age, grade):
        if id in self.students:
            print("Student with this ID already exists.")
            return
        self.students[id] = Student(id, name, age, grade)

    def display_students(self):
        if not self.students:
            print("No students to display.")
            return
        for student in self.students.values():
            print(student)

    def search_student(self, id):
        student = self.students.get(id)
        if student:
            print(student)
        else:
            print("Student not found.")

    def delete_student(self, id):
        if id in self.students:
            del self.students[id]
        else:
            print("Student not found.")

def main():
    manager = StudentManager()
    while True:
        print("\n1. Add Student")
        print("2. Display Students")
        print("3. Search Student")
        print("4. Delete Student")
        print("5. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            id = input("Enter student ID: ")
            name = input("Enter student name: ")
            age = input("Enter student age: ")
            grade = input("Enter student grade: ")
            manager.add_student(id, name, int(age), int(grade))
        elif choice == '2':
            manager.display_students()
        elif choice == '3':
            id = input("Enter student ID to search: ")
            manager.search_student(id)
        elif choice == '4':
            id = input("Enter student ID to delete: ")
            manager.delete_student(id)
        elif choice == '5':
            print("Exiting the program.")
            break
        else:
            print("Invalid choice. Please try again.")

if __name__ == "__main__":
    main()